package com.zyk.scaffold.gateway.enums;


import com.zyk.scaffold.common.basic.BasicErrorCode;
import com.zyk.scaffold.common.enums.ModuleEnum;

public enum GatewayErrorCodeEnum implements BasicErrorCode {
    TOKEN_INVALID_ERROR(101,"token无效，请重新登录"),
    REQUEST_ULTRA_VIRES_ERROR(102,"请求越权"),
    TOKEN_INVALID_FAIL(103,"token校验失败"),



    /**
     * api-time-stamp 获取不到
     * 错误码:600006
     */
    OPEN_API_TIME_STAMP_REQUIRED(6, "open api:api-time-stamp is required."),

    /**
     * sign 超时
     * 错误码:600007
     */
    OPEN_API_SIGN_TIME_OUT(7, "open api:sign is time out."),

    /**
     * app-sign 获取不到
     * 错误码:600008
     */
    OPEN_API_SIGN_REQUIRED(8, "open api:api-sign is required."),

    /**
     * app key 不可用
     * 错误码:600009
     */
    OPEN_API_APP_KEY_NOT_AVAILABLE(9, "open api:app key not available."),
    /**
     * app 不可用
     * 错误码:600010
     */
    OPEN_API_APP_NOT_AVAILABLE(10, "open api:app not available."),

    /**
     * sign 错误
     * 错误码:600011
     */
    OPEN_API_SIGN_ERROR(11, "open api:sign is error."),

    /**
     * content-type 不支持
     * 错误码:600012
     */
    OPEN_API_CONTENT_TYPE_UNSUPPORT(12, "open api:content-type un support,plase mark :application/x-www-form-urlencoded、multipart/form-data、application/json"),

    /**
     * 请求频率超出限制
     * 错误码:600013
     */
    OPEN_API_FREQUENCY_OUT_OF_LIMIT(13, "open api:Frequency out of limit, Please try again later"),

    ;

    private final int code;

    private final String desc;

    private final int moduleCode = ModuleEnum.OAUTH.getCode();

    GatewayErrorCodeEnum(int code, String desc) {
        this.code = ERROR_CODE_LEVEL * moduleCode + code;
        this.desc = desc;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return desc;
    }

}
